package com.zxl.yjb.jpush;

import android.content.Context;

import com.zxl.yjb.utils.LogUtil;

import cn.jpush.android.api.JPushMessage;
import cn.jpush.android.service.JPushMessageReceiver;

/**
 * 自定义JPush message 接收器,包括操作tag/alias的结果返回(仅仅包含tag/alias新接口部分)
 * */
public class JpushOnSetTatOrAliasReceiver extends JPushMessageReceiver {
    private String TAG ="JPushMessageReceiver";
    @Override
    public void onTagOperatorResult(Context context,JPushMessage jPushMessage) {
        if(jPushMessage.getErrorCode() == 0){
            String logs = " tag "+jPushMessage.getCheckTag() + " bind state success,state:"+jPushMessage.getTagCheckStateResult();
            LogUtil.i(TAG,logs);
        }else{
            String logs = "Failed to " +" tags, errorCode:" + jPushMessage.getErrorCode();
            LogUtil.e(TAG, logs);
        }
        super.onTagOperatorResult(context, jPushMessage);
    }
    @Override
    public void onCheckTagOperatorResult(Context context,JPushMessage jPushMessage){
//        TagAliasOperatorHelper.getInstance().onCheckTagOperatorResult(context,jPushMessage);
        super.onCheckTagOperatorResult(context, jPushMessage);
    }
    @Override
    public void onAliasOperatorResult(Context context, JPushMessage jPushMessage) {
        int sequence = jPushMessage.getSequence();
        if(jPushMessage.getErrorCode() == 0){
            LogUtil.i(TAG,"action - modify alias Success,sequence:"+sequence);
        }else {
            String logs = "Failed to " +  " alias, errorCode:" + jPushMessage.getErrorCode();
            LogUtil.e(TAG, logs);
        }
        super.onAliasOperatorResult(context, jPushMessage);
    }

    @Override
    public void onMobileNumberOperatorResult(Context context, JPushMessage jPushMessage) {
//        TagAliasOperatorHelper.getInstance().onMobileNumberOperatorResult(context,jPushMessage);
        super.onMobileNumberOperatorResult(context, jPushMessage);
    }

}
